package systemEntity

import (
	"github.com/goravel/framework/database/orm"
	"goravel/app/models/common"
)

type Menu struct {
	orm.Model
	ParentID    uint         `gorm:"column:parentId;default:null" json:"parentId" form:"parentId"`
	Path        string       `gorm:"column:path" json:"path" form:"path"`
	Component   string       `gorm:"column:component" json:"component" form:"component"`
	Name        string       `gorm:"column:name" json:"name" form:"name"`
	Meta        common.Meta  `gorm:"column:meta;" json:"meta" form:"meta"`
	Redirect    string       `gorm:"column:redirect" json:"redirect" form:"redirect"`
	Permissions []Permission `gorm:"many2many:menu_permissions;" json:"permissions" form:"permissions"` // 关联权限
	Children    []Menu       `gorm:"foreignkey:parentId" form:"children" json:"children,omitempty"`     // 子菜单
	orm.SoftDeletes
}
